<?php
class input{
    public static function get($key, $filter=''){ 
        if(isset($_GET[$key])){
            return $filter ? self::$filter($_GET[$key]) : $_GET[$key];   
        }
        return false;
    }
    public static function post($key, $filter=''){ 
        if(isset($_POST[$key])){
            return $filter ? self::$filter($_POST[$key]) : $_POST[$key]; 
        }
        return false;
    }
    public static function request($key, $filter=''){ 
        if(isset($_REQUEST[$key])){
            return $filter ? self::$filter($_REQUEST[$key]) : $_REQUEST[$key]; 
        }
        return false;
    }
    private static function text($str){ return htmlencode(trim($str));}
    private static function int($n){ return intval($n);}
	private static function num($str){ return preg_replace('/[^0-9]+/i','',strval($str));}
    private static function float($n){ return floatval($n);}
    private static function char($str){ return preg_replace('/[^a-z]+/i','',$str);}
    private static function html($str){ return filter_xss($str);}
    private static function ajaxcn($str){ return iconv('UTF-8','GBK',trim($str));}
}